#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by master on 2017/3/5

class SchoolMember(object):
    members_nums = 0

    def __init__(self, name, age, sex):
        self.name = name
        self.age = age
        self.sex = sex
        self.enroll()  # 初始化后的操作

    def enroll(self):
        print("The [%s] SchoolMember [%s] is enrolled..." % (SchoolMember.members_nums,self.name))
        SchoolMember.members_nums += 1

    def tell(self):
        print("Hello, my name is [%s]", self.name)


class Teacher(SchoolMember):
    # 既要继承父类  又要对父类进行扩展
    def __init__(self, name, age, sex, course, salary):  # 先重写父类的成员
        # SchoolMember.__init__(self,name,age,sex)# 旧式写法  已已废弃
        super(Teacher, self).__init__(name, age, sex)  # 再继承父类
        self.course = course
        self.salary = salary

    def teaching(self):
        print("Teacher [%s] is teaching [%s]", self.name, self.course)


class Student(SchoolMember):
    def __init__(self, name, age, sex, course, tuition):
        super(Student, self).__init__(name, age, sex)
        self.course = course
        self.tuition = tuition

    def pay_tuition(self):
        print("cao ,student [%s] paying tuition [%s] " % (self.name, self.tuition))


t1 = Teacher("Alex", "22", "F", "PY", "1000")
t2 = Teacher("Tenglan", "25", "N/A", "PY", "900")

s1 = Student("sanjiang", "24", "Female", "python", "15000")
s2 = Student("baoan", "25", "F", "python", "5000")
